# -*- coding: utf-8 -*-
# @Author: Wolf
# @Date:   2025-03-21 10:50:33
# @Last Modified by:   Wolf
# @Last Modified time: 2025-03-24 11:44:32
from django.db import models

# Create your models here.


class Department(models.Model):
    """ 部门表 """
    #id = models.BigAutoField(verbose_name="ID",primary_key=True)
    title = models.CharField(verbose_name="标题-这是对字段注解",max_length=32)
    def __str__(self):
        return self.title


class UserInfo(models.Model):
    """ 用户表 """
    #id = models.BigAutoField(verbose_name="ID",primary_key=True)
    name = models.CharField(verbose_name="姓名",max_length=32)
    password = models.CharField(verbose_name="密码",max_length=64)
    age = models.IntegerField(verbose_name="年龄")
    account = models.DecimalField(verbose_name="账户余额",max_digits=10,decimal_places=2,default=None)
    # create_time = models.DateTimeField(verbose_name="加入时间")
    create_time = models.DateField(verbose_name="加入时间")

    depart = models.ForeignKey(verbose_name="关联部门表ID",to="Department",to_field="id",on_delete=models.SET_NULL,null=True,blank=True)
    
    #django中自定义约束
    gender_choices = (
        (1,"男"),
        (2,"女")
        )
    gender = models.SmallIntegerField(verbose_name="性别", choices=gender_choices)

class PrettyNum(models.Model):
    mobile = models.CharField(verbose_name="号码",max_length=11)
    price  = models.DecimalField(verbose_name="价格",max_digits=6,decimal_places=2)

    level_choices = (
        (1,"1级"),
        (2,"2级"),
        (3,"3级"),
        (4,"4级"),
        )
    level = models.SmallIntegerField(verbose_name="级别",choices=level_choices)

    status_choices = (
        (1,"占用"),
        (2,"未占用")
        )
    status = models.SmallIntegerField(verbose_name="状态",choices=status_choices,default=2)